<template>
  <div>
    <el-tabs v-model="activeName" style="padding: 10px 15px 0 0" type="card" @tab-click="handleTabClick">
      <template v-for="item in optList">
        <el-tab-pane :key="item.code" :name="item.code" :label="item.name" />
      </template>
    </el-tabs>
    <router-view />
    <!-- <hotel v-if="activeName === 'Hotel'" />
    <pick-up v-if="activeName === 'PickUp'" /> -->
  </div>
</template>
<script>
// import hotel from './hotel/index';
// import pickUp from './pickUp/index';
// import catering from './catering/index';
// import { mapState } from 'vuex';
export default {
  components: {
    // hotel,
    // pickUp
  },
  data() {
    return {
      activeName: '',
      optList: [
        {
          code: 'SubstationLogisticsHotel',
          name: '酒店设置'
          // component: hotel
        },
        {
          code: 'SubstationLogisticsPickUp',
          name: '接待设置'
          // component: pickUp
        },
        {
          code: 'SubstationLogisticsCatering',
          name: '就餐设置'
          // component: caterng
        }
      ]
    };
  },
  computed: {
    // ...mapState({
    //   tenantId: state => state.user.tenantId
    // })
  },
  created() {
    this.activeName = this.$route.query.logisticType || 'SubstationLogisticsHotel';
  },
  methods: {
    handleTabClick(tabItem) {
      const { query } = this.$route;
      query.logisticType = tabItem.name;
      this.$router.push({
        name: tabItem.name,
        query: query
      });
    }
  }
};
</script>
